-- 运动行为的基类


-- 模块定义
local M = 
{
	_base_class = require "components.BaseComponent",
	_class_name = "components.MovingComponent"
}
setmetatable (M, {__index = _G;});
_ENV = M;

-- 引用模块
local Tools = require ("tools.CommonTools");


-- 方法定义
operation_table = Tools.CreateOperationTable (_base_class);

function operation_table.SetPosition (self, position)
	-- TODO xiewneqi 设置物体位置，position是个vector3
end

function operation_table.GetPosition (self)
	-- TODO 获得物体位置
end

function operation_table.SetVelocity (self, velocity)
	self.m_vVelocity = velocity;
end

-- 获取物体当前的速度
function operation_table.GetVelocity (self)
	return self.m_vVelocity;
end

-- 构造方法
function new_moving_behaviour ()
	local instance = _base_class.NewBaseComponent ();
	Tools.PrepareInstance (M, instance);
	
	-- 在这里定义成员变量
	instance.m_vVelocity = UnityVector3Lib.zero ();
	instance.m_vHeading = UnityVector3Lib.zero ();
	instance.m_vSide = UnityVector3Lib.zero ();
	instance.m_dMass = 1.0f;
	instance.m_dMaxSpeed = 1.0f;
	instance.m_dMaxForce = 1.0f;
	instance.m_dMaxTurnRate = 1.0f;

	return instance;
end;

return M;

